package com.qf.lja.servlet;

import com.qf.lja.dao.ProductDao;
import com.qf.lja.enity.Product;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(urlPatterns = "/mpInfo")
public class MProInfo extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String productId = req.getParameter("productId");
        Product product = new ProductDao().findByProductId(Integer.parseInt(productId));
        req.setAttribute("product", product);
        req.getRequestDispatcher("/mproductinfo.jsp").forward(req, resp);
    }
}
